package com.big.patient.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.big.model.model.patient.PatientDsn;
import com.big.patient.mapper.PatientDsnMapper;
import com.big.patient.service.PatientDsnService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
@Slf4j
public class PatientDsnServiceImpl extends ServiceImpl<PatientDsnMapper, PatientDsn> implements PatientDsnService {



    //密
    @Override
    public void saveDsn(PatientDsn patientDsn) {
        log.info("密:\t",patientDsn);
        baseMapper.insert(patientDsn);
    }

    //查用户密
    @Override
    public PatientDsn findInfoDns(String phone) {
        QueryWrapper queryWrapper = new QueryWrapper();
        if(!StringUtils.isEmpty(phone)){
         queryWrapper.eq("phone",phone);
        }

        return baseMapper.selectOne(queryWrapper);
    }

    @Override
    public PatientDsn findAdminDnsInfo(String uId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        if(!StringUtils.isEmpty(uId)){
            queryWrapper.eq("u_id",uId);
        }

        return baseMapper.selectOne(queryWrapper);
    }


}
